//
//  Number+SJAdd.swift
//  SJSwiftKit
//
//  Created by swordjoy on 2017/3/13.
//  Copyright © 2017年 swordjoy. All rights reserved.
//

import Foundation
import UIKit

public extension Int64 {
  
  var cgFloat: CGFloat { return CGFloat(self).ceilValue }
  
}

public extension NSNumber {
    var cgFloat: CGFloat { return CGFloat(truncating: self) }
}

public extension Int {
  var doubleValue: Double { return Double(self) }
  
  var cgFloat: CGFloat { return CGFloat(self).ceilValue }
  
  var adaptor: CGFloat {
    let sacle = UIScreen.width / 375
    let temp = self.cgFloat * sacle
    return temp.intRound.cgFloat
  }
  
  var ASCII_CHAR: String {
    return Character(UnicodeScalar(self)!).description
  }
}

public extension Double {
    var intValue: Int { return Int(self) }

    var intRound: Int { return lround(self) }

    var cgFloat: CGFloat { return CGFloat(self) }
    
    var string02: String { return String(format: "%.2f", self)}
}

public extension CGFloat {
  var intValue: Int { return Int(self) }
  
  var intRound: Int { return lroundf(Float(self)) }
  
  var doubleValue: Double { return Double(self) }
    
    var ceilValue: CGFloat {
        return ceil(doubleValue).cgFloat
    }
  
  var adaptor: CGFloat {
    let sacle = UIScreen.width / 375
    let temp = self * sacle
    return temp.intRound.cgFloat
  }
}
